<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>INSPINIA | Basic Form</title>
	<link href="#springUrl('/static/css/bootstrap.min.css')" rel="stylesheet">
	<link href="#springUrl('/static/css/style.css')" rel="stylesheet">
    <link href="#springUrl('/static/css/jquery-ui.css')" rel="stylesheet">
</head>
<body class="white-bg">
<div class="ibox-content" style="width: 430px;">
   <form id="myForm" class="form-horizontal" autocomplete="off" data-validator-option="{theme:'default'}">
   	   <input type="hidden" name="id" value="$!{shopUser.id}">
       <div class="form-group"><label class="col-sm-2 control-label">昵称</label>
           <div class="col-sm-10">
           		<input type="text" class="form-control" value="$!{shopUser.nickname}" name="nickname" >
           </div>
       </div>
       <!--<div class="form-group"><label class="col-sm-2 control-label">头像</label>
           <div class="col-sm-10">
           		<input type="file" class="form-control" name="headImageAddr" value="$!{shopUser.headImageAddr}" >
           </div>
       </div>-->
       <div class="form-group"><label class="col-sm-2 control-label">手机号</label>
           <div class="col-sm-10">
               <input type="text" class="form-control" name="mobilePhone" value="$!{shopUser.mobilePhone}" >
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">出生日期</label>
           <div class="col-sm-10">
               <input type="text" class="form-control"  name="dateOfBirth" onload="" value="$!{shopUser.dateOfBirth}">
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">肤质</label>
           <div class="col-sm-10">
               <input type="text" readonly="true" class="form-control"  id="skinType"
                      #if($!{shopUser.skinType}==0) value="干性" #end
                      #if($!{shopUser.skinType}==1) value="混合" #end
                      #if($!{shopUser.skinType}==2) value="油性" #end
                      #if($!{shopUser.skinType}==3) value="中性" #end
                      #if($!{shopUser.skinType}==4) value="敏感" #end
               >
               <input type="hidden" name="skinType" value="$!{shopUser.skinType}">
           </div>
       </div>

       <div class="form-group"><label class="col-sm-2 control-label">默认地址</label>
           <div class="col-sm-10">
               <input type="text" class="form-control" readonly="true"  value="$!{shopUser.shopUserAddr.address}" >
               <input type="hidden" name="defaultAddr" value="$!{shopUser.defaultAddr}">
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2  control-label" >分享数量</label>
           <div class="col-sm-10">
               <input type="text" class="form-control" name="shardCount"  value="$!{shopUser.shardCount}" readonly="true" >
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">点评数量</label>
           <div class="col-sm-10">
               <input type="text" class="form-control" name="evaluateCount" value="$!{shopUser.evaluateCount}" readonly="true" >
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">分享佣金</label>
           <div class="col-sm-10">
               <input type="text" class="form-control" name="shardBonus" value="$!{shopUser.shardBonus}" readonly="true" >
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">点评佣金</label>
           <div class="col-sm-10">
               <input type="text" class="form-control" name="evaluateBonus" value="$!{shopUser.evaluateBonus}"  readonly="true" >
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">状态</label>
           <div class="col-sm-10">
               <!--0是正常,1不能购买,2不能点评,3没有佣金,4,不能提现-->
               <!--<input type="hidden"  name="state" value="$!{shopUser.state}"   >-->
               <select class="form-control m-b" name="state" id="state">
                   <option value="0" #if($!{shopUser.state}==0) selected="selected" #end >正常</option>
                   <option value="1" #if($!{shopUser.state}==1) selected="selected" #end  >不能购买</option>
                   <option value="2" #if($!{shopUser.state}==2) selected="selected" #end  >不能点评</option>
                   <option value="3" #if($!{shopUser.state}==3) selected="selected" #end  >没有佣金</option>
                   <option value="4" #if($!{shopUser.state}==4) selected="selected" #end  >不能提现</option>
                   <!--<option value="2" >分享数量</option>-->
               </select>
           </div>
       </div>
        <!--<div class="form-group"><label class="col-sm-2 control-label">用户角色</label>
            <div class="col-sm-10">
            <select class="form-control m-b" name="rid">
            	#foreach($role in $roleList)
                <option id="$!{role.id}">$!{role.name}</option>
                #end
            </select>
            </div>
        </div>-->
        <div class="hr-line-dashed"></div>
        <div class="form-group">
            <div class="text-center">
                <button class="btn btn-primary" type="submit">修 改</button>
            </div>
        </div>
    </form>
</div>
<script src="#springUrl('/static/js/jquery-2.1.1.js')"></script>
<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js?local=zh-CN')"></script>
<script src="#springUrl('/static/js/jquery-ui.custom.min.js')"></script>
<script src="#springUrl('/static/js/jquery-ui-1.10.4.min.js')"></script>
<script type="text/javascript">
    $(function(){
        $( "#dateOfBirth" ).datepicker({
            altField: "#alternate",
            altFormat: "DD, d MM, yy"
        });
    });
$("#myForm").validator({
    valid: function(form){
        var me = this;
        var dt = $(form).serialize();
        var str = JSON.stringify(dt);
        // 提交表单之前，hold住表单，防止重复提交
        me.holdSubmit();
        $.ajax({
        	url: "#springUrl('/shopuser/editShopUser')",
            data: dt,
            type: "POST",
            success: function(data){
            	var d = JSON.parse(data);
                if(d.success && d.data){
                	window.parent.location.reload();
                	//当你在iframe页面关闭自身时
                	//var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                	//parent.layer.close(index); //再执行关闭
                } else {
                	//失败，提交表单成功后，释放hold，如果不释放hold，就变成了只能提交一次的表单
                    me.holdSubmit(false);
                }
            }
        });
    }
});
</script>
</body>
</html>
